<?php

namespace App\Http\Api\Controller\V1;

use App\Http\Common\Controller\AbstractController;
use App\Http\Common\Result;
use App\Request\auth\Service\User\UserService;
use App\Request\user\UserRequest;
use Exception;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;
use Hyperf\Validation\Annotation\Scene;

/**
 * 公共接口
 */
#[Controller(
    prefix: '/api/v1/public/'
)]

class PublicController extends AbstractController
{

    public function __construct(
        protected readonly UserService $userService,
    )
    {
    }

    /**
     * Pc登录
     * @param UserRequest $request
     * @return Result
     * @throws Exception
     */
    #[Scene(scene: 'login',argument: 'request')]
    #[PostMapping('login')]
    public function login(UserRequest $request): Result
    {
         return $this->success($this->userService->login($request->all()));
    }




}